<pre>
<?php

$text="{ Block   id  |a b='{1}' d='_(ytd)' c='|'  [} 1 2{Block id2[} {a} 3{]id2} 4 {]id}";
$text1="{Block id [} 1 2{Block id2|} 3 4 {]id}";
$text2="{Block id[}{]id}";
$text3="
{  Block id 
   [} X  {]
         id}";
$text4='
{  Block id 
		| a="{1}" b="_(Enter)" c="|"
   [  }<> 
     X  
   <}{  ]
         id}';
$text5="{Block id | a={} |}";
$text6="{met|}";
/**
* {Classname identifier | attr1=".." attr2="..." [} Block {]identifier}
**/
$class     = "(\w+)";
$id        = "(\w+)";
$argmark   = "\|";
$args      = "(.*)";
$beginmark = "\[";
$begin     = "\{\s*".$class."\s+".$id."\s*(".$argmark."\s*".$args."){0,1}\s*".$beginmark ."\s*\}";
$endmark   = "\]";
$end       = "\{\s*". $endmark  ."\s*\g{2}\s*\}";
$block     = "(.*)";

echo $patt1="/". $begin . $block . $end  ."/Us";
/**
* {Classname identifier | attr1=".." attr2="..."}
*/
echo $bshort = "/\{\s*".  $class  ."\s+".   $id ."\s*(".$argmark ."\s*" . $args ."){0,1}\s*\|\s*\}/";

$method = "/\{\s*".$id ."\s*(".$argmark ."\s*" . $args ."){0,1}\s*\|\s*\}/";

preg_match_all($method,$text6,$match, PREG_PATTERN_ORDER);



print_r($match);

?>